package stv
{
	import mx.collections.ArrayCollection;
	import mx.controls.DataGrid;
	
	public class ExtendedObject
	{	
		protected var _paramsNames:Array;
		
		public function ExtendedObject()
		{
		}
		
		public function getFromXML(xmlList:XMLList):void {
			for each (var value:String in this._paramsNames){
				if (this[value] is String){
					this[value]=xmlList.child(value);
				}else if (this[value] is Boolean){
						if (xmlList.child(value) == "true"){
							this[value]=true;  
							}else{
								 this[value]=false;
						 	}
					}else if (this[value] is Number){
						trace("Nummer----------------------"+xmlList.child(value));
						this[value]=xmlList.child(value);
						} else {
							this[value]=xmlList.child(value);
						}
				}
				
		}
	
		public function get paramsNames():Array {
			return this._paramsNames;
		}
		
		public function get dataProvider():ArrayCollection {
			var dp:ArrayCollection = new ArrayCollection();
            for each (var value:String in this._paramsNames){
            	var data:Object= new Object();
            	data.ValueName = value;
            	data.ValueValue=this[value].toString();
         	   	dp.addItem(data);
			}
			return dp;
		}
		
		
		public function toString():String {
			var output:String = "\n";
			for each (var value:String in this._paramsNames){
				output+="["+value+"]: " + this[value] + "\n";
			}
			return output;
		}
	}
}